<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.4"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Arduino LibLAME: src/MP3EncoderLAME.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectalign">
   <div id="projectname">Arduino LibLAME
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.4 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search",'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle"><div class="title">MP3EncoderLAME.h</div></div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno">    1</span><span class="preprocessor">#pragma once</span></div>
<div class="line"><a id="l00002" name="l00002"></a><span class="lineno">    2</span> </div>
<div class="line"><a id="l00003" name="l00003"></a><span class="lineno">    3</span><span class="preprocessor">#include &quot;<a class="code" href="lame__log_8h.html">lame_log.h</a>&quot;</span></div>
<div class="line"><a id="l00004" name="l00004"></a><span class="lineno">    4</span><span class="preprocessor">#include &quot;liblame/lame.h&quot;</span></div>
<div class="line"><a id="l00005" name="l00005"></a><span class="lineno">    5</span><span class="preprocessor">#include &lt;stdint.h&gt;</span></div>
<div class="line"><a id="l00006" name="l00006"></a><span class="lineno">    6</span><span class="preprocessor">#include &lt;unistd.h&gt;</span></div>
<div class="line"><a id="l00007" name="l00007"></a><span class="lineno">    7</span> </div>
<div class="line"><a id="l00008" name="l00008"></a><span class="lineno">    8</span><span class="keyword">namespace </span>liblame {</div>
<div class="line"><a id="l00009" name="l00009"></a><span class="lineno">    9</span> </div>
<div class="line"><a id="l00010" name="l00010"></a><span class="lineno">   10</span><span class="keyword">typedef</span> void (*MP3CallbackFDK)(uint8_t *mp3_data, <span class="keywordtype">size_t</span> len);</div>
<div class="line"><a id="l00016" name="l00016"></a><span class="lineno"><a class="line" href="structliblame_1_1_audio_info.html">   16</a></span><span class="keyword">struct </span><a class="code hl_struct" href="structliblame_1_1_audio_info.html">AudioInfo</a> {</div>
<div class="line"><a id="l00017" name="l00017"></a><span class="lineno">   17</span>  <a class="code hl_struct" href="structliblame_1_1_audio_info.html">AudioInfo</a>() = <span class="keywordflow">default</span>;</div>
<div class="line"><a id="l00018" name="l00018"></a><span class="lineno">   18</span>  <a class="code hl_struct" href="structliblame_1_1_audio_info.html">AudioInfo</a>(<span class="keyword">const</span> <a class="code hl_struct" href="structliblame_1_1_audio_info.html">AudioInfo</a> &amp;) = <span class="keywordflow">default</span>;</div>
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno">   19</span>  <span class="keywordtype">int</span> sample_rate = 16000;</div>
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno">   20</span>  <span class="keywordtype">int</span> channels = 1;</div>
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno">   21</span>  <span class="keywordtype">int</span> bits_per_sample = 16; <span class="comment">// we assume int16_t</span></div>
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno">   22</span>  <span class="keywordtype">int</span> quality = 7;          <span class="comment">// 0..9.  0=best (very slow).  9=worst.</span></div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno">   23</span>  <span class="keywordtype">int</span> frame_size = 0;       <span class="comment">// determined by decoder</span></div>
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno">   24</span>};</div>
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno">   25</span> </div>
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno"><a class="line" href="classliblame_1_1_m_p3_encoder_l_a_m_e.html">   32</a></span><span class="keyword">class </span><a class="code hl_class" href="classliblame_1_1_m_p3_encoder_l_a_m_e.html">MP3EncoderLAME</a> {</div>
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno">   33</span> </div>
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno">   34</span><span class="keyword">public</span>:</div>
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno"><a class="line" href="classliblame_1_1_m_p3_encoder_l_a_m_e.html#a7e35cfa7cc48b05cf49b0b72ef0e03bc">   37</a></span>  <a class="code hl_function" href="classliblame_1_1_m_p3_encoder_l_a_m_e.html#a7e35cfa7cc48b05cf49b0b72ef0e03bc">MP3EncoderLAME</a>() { LOG_LAME(Debug, __FUNCTION__); }</div>
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno">   38</span> </div>
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno"><a class="line" href="classliblame_1_1_m_p3_encoder_l_a_m_e.html#a54352c07c33e664c8c2bd72331c8b070">   40</a></span>  <a class="code hl_function" href="classliblame_1_1_m_p3_encoder_l_a_m_e.html#a54352c07c33e664c8c2bd72331c8b070">MP3EncoderLAME</a>(MP3CallbackFDK cb) {</div>
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno">   41</span>    LOG_LAME(Debug, __FUNCTION__);</div>
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno">   42</span>    <a class="code hl_function" href="classliblame_1_1_m_p3_encoder_l_a_m_e.html#a8385df8de26ce70ea594f3b7deee6415">setDataCallback</a>(cb);</div>
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno">   43</span>  }</div>
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno">   44</span> </div>
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno"><a class="line" href="classliblame_1_1_m_p3_encoder_l_a_m_e.html#a8385df8de26ce70ea594f3b7deee6415">   46</a></span>  <span class="keywordtype">void</span> <a class="code hl_function" href="classliblame_1_1_m_p3_encoder_l_a_m_e.html#a8385df8de26ce70ea594f3b7deee6415">setDataCallback</a>(MP3CallbackFDK cb) {</div>
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno">   47</span>    LOG_LAME(Debug, __FUNCTION__);</div>
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno">   48</span>    this-&gt;MP3Callback = cb;</div>
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno">   49</span>  }</div>
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno">   50</span> </div>
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno">   51</span><span class="preprocessor">#ifdef ARDUINO</span></div>
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno">   52</span> </div>
<div class="line"><a id="l00055" name="l00055"></a><span class="lineno"><a class="line" href="classliblame_1_1_m_p3_encoder_l_a_m_e.html#a2fe02f33ec1c5fc4cb7e14354bc6a2fd">   55</a></span>  <a class="code hl_function" href="classliblame_1_1_m_p3_encoder_l_a_m_e.html#a2fe02f33ec1c5fc4cb7e14354bc6a2fd">MP3EncoderLAME</a>(Print &amp;out_stream) {</div>
<div class="line"><a id="l00056" name="l00056"></a><span class="lineno">   56</span>    LOG_LAME(Debug, __FUNCTION__);</div>
<div class="line"><a id="l00057" name="l00057"></a><span class="lineno">   57</span>    this-&gt;out = &amp;out_stream;</div>
<div class="line"><a id="l00058" name="l00058"></a><span class="lineno">   58</span>  }</div>
<div class="line"><a id="l00059" name="l00059"></a><span class="lineno">   59</span> </div>
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno"><a class="line" href="classliblame_1_1_m_p3_encoder_l_a_m_e.html#a0f0fca79af6535e186a5555bd9019c50">   61</a></span>  <span class="keywordtype">void</span> <a class="code hl_function" href="classliblame_1_1_m_p3_encoder_l_a_m_e.html#a0f0fca79af6535e186a5555bd9019c50">setOutput</a>(Print &amp;out_stream) {</div>
<div class="line"><a id="l00062" name="l00062"></a><span class="lineno">   62</span>    LOG_LAME(Debug, __FUNCTION__);</div>
<div class="line"><a id="l00063" name="l00063"></a><span class="lineno">   63</span>    this-&gt;out = &amp;out_stream;</div>
<div class="line"><a id="l00064" name="l00064"></a><span class="lineno">   64</span>  }</div>
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno">   65</span> </div>
<div class="line"><a id="l00066" name="l00066"></a><span class="lineno">   66</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00067" name="l00067"></a><span class="lineno">   67</span> </div>
<div class="line"><a id="l00068" name="l00068"></a><span class="lineno">   68</span>  <a class="code hl_class" href="classliblame_1_1_m_p3_encoder_l_a_m_e.html">~MP3EncoderLAME</a>() {</div>
<div class="line"><a id="l00069" name="l00069"></a><span class="lineno">   69</span>    LOG_LAME(Debug, __FUNCTION__);</div>
<div class="line"><a id="l00070" name="l00070"></a><span class="lineno">   70</span>    <a class="code hl_function" href="classliblame_1_1_m_p3_encoder_l_a_m_e.html#af50990122ad669a7a4755aac47d5046f">end</a>();</div>
<div class="line"><a id="l00071" name="l00071"></a><span class="lineno">   71</span>    <span class="comment">// release buffers</span></div>
<div class="line"><a id="l00072" name="l00072"></a><span class="lineno">   72</span>    <span class="keywordflow">if</span> (convert_buffer != <span class="keyword">nullptr</span>)</div>
<div class="line"><a id="l00073" name="l00073"></a><span class="lineno">   73</span>      <span class="keyword">delete</span>[] convert_buffer;</div>
<div class="line"><a id="l00074" name="l00074"></a><span class="lineno">   74</span>    <span class="keywordflow">if</span> (mp3_buffer != <span class="keyword">nullptr</span>)</div>
<div class="line"><a id="l00075" name="l00075"></a><span class="lineno">   75</span>      <span class="keyword">delete</span>[] mp3_buffer;</div>
<div class="line"><a id="l00076" name="l00076"></a><span class="lineno">   76</span>  }</div>
<div class="line"><a id="l00077" name="l00077"></a><span class="lineno">   77</span> </div>
<div class="line"><a id="l00081" name="l00081"></a><span class="lineno"><a class="line" href="classliblame_1_1_m_p3_encoder_l_a_m_e.html#a0be6b928f81d76de826faec024a9003a">   81</a></span>  <span class="keywordtype">void</span> <a class="code hl_function" href="classliblame_1_1_m_p3_encoder_l_a_m_e.html#a0be6b928f81d76de826faec024a9003a">begin</a>() {</div>
<div class="line"><a id="l00082" name="l00082"></a><span class="lineno">   82</span>    LOG_LAME(Debug, __FUNCTION__);</div>
<div class="line"><a id="l00083" name="l00083"></a><span class="lineno">   83</span>    active = setup();</div>
<div class="line"><a id="l00084" name="l00084"></a><span class="lineno">   84</span>  }</div>
<div class="line"><a id="l00085" name="l00085"></a><span class="lineno">   85</span> </div>
<div class="line"><a id="l00092" name="l00092"></a><span class="lineno"><a class="line" href="classliblame_1_1_m_p3_encoder_l_a_m_e.html#a4fb46c73fd0be4e376c1f72d875b3297">   92</a></span>  <span class="keywordtype">void</span> <a class="code hl_function" href="classliblame_1_1_m_p3_encoder_l_a_m_e.html#a4fb46c73fd0be4e376c1f72d875b3297">begin</a>(<a class="code hl_struct" href="structliblame_1_1_audio_info.html">AudioInfo</a> in) {</div>
<div class="line"><a id="l00093" name="l00093"></a><span class="lineno">   93</span>    LOG_LAME(Debug, __FUNCTION__);</div>
<div class="line"><a id="l00094" name="l00094"></a><span class="lineno">   94</span>    <a class="code hl_function" href="classliblame_1_1_m_p3_encoder_l_a_m_e.html#af244cdcd8bac44f739d874038216b1cf">setAudioInfo</a>(in);</div>
<div class="line"><a id="l00095" name="l00095"></a><span class="lineno">   95</span>    active = setup();</div>
<div class="line"><a id="l00096" name="l00096"></a><span class="lineno">   96</span>  }</div>
<div class="line"><a id="l00097" name="l00097"></a><span class="lineno">   97</span> </div>
<div class="line"><a id="l00106" name="l00106"></a><span class="lineno"><a class="line" href="classliblame_1_1_m_p3_encoder_l_a_m_e.html#a47b52eaec66ff4513a483d4ce6ceeb6a">  106</a></span>  <span class="keywordtype">void</span> <a class="code hl_function" href="classliblame_1_1_m_p3_encoder_l_a_m_e.html#a47b52eaec66ff4513a483d4ce6ceeb6a">begin</a>(<span class="keywordtype">int</span> input_channels, <span class="keywordtype">int</span> input_sample_rate,</div>
<div class="line"><a id="l00107" name="l00107"></a><span class="lineno">  107</span>             <span class="keywordtype">int</span> input_bits_per_sample) {</div>
<div class="line"><a id="l00108" name="l00108"></a><span class="lineno">  108</span>    LOG_LAME(Debug, __FUNCTION__);</div>
<div class="line"><a id="l00109" name="l00109"></a><span class="lineno">  109</span>    <a class="code hl_struct" href="structliblame_1_1_audio_info.html">AudioInfo</a> ai;</div>
<div class="line"><a id="l00110" name="l00110"></a><span class="lineno">  110</span>    ai.channels = input_channels;</div>
<div class="line"><a id="l00111" name="l00111"></a><span class="lineno">  111</span>    ai.sample_rate = input_sample_rate;</div>
<div class="line"><a id="l00112" name="l00112"></a><span class="lineno">  112</span>    ai.bits_per_sample = input_bits_per_sample;</div>
<div class="line"><a id="l00113" name="l00113"></a><span class="lineno">  113</span>    <a class="code hl_function" href="classliblame_1_1_m_p3_encoder_l_a_m_e.html#af244cdcd8bac44f739d874038216b1cf">setAudioInfo</a>(ai);</div>
<div class="line"><a id="l00114" name="l00114"></a><span class="lineno">  114</span>    active = setup();</div>
<div class="line"><a id="l00115" name="l00115"></a><span class="lineno">  115</span>  }</div>
<div class="line"><a id="l00116" name="l00116"></a><span class="lineno">  116</span> </div>
<div class="line"><a id="l00118" name="l00118"></a><span class="lineno"><a class="line" href="classliblame_1_1_m_p3_encoder_l_a_m_e.html#af244cdcd8bac44f739d874038216b1cf">  118</a></span>  <span class="keywordtype">void</span> <a class="code hl_function" href="classliblame_1_1_m_p3_encoder_l_a_m_e.html#af244cdcd8bac44f739d874038216b1cf">setAudioInfo</a>(<a class="code hl_struct" href="structliblame_1_1_audio_info.html">AudioInfo</a> in) { this-&gt;info = in; }</div>
<div class="line"><a id="l00119" name="l00119"></a><span class="lineno">  119</span> </div>
<div class="line"><a id="l00121" name="l00121"></a><span class="lineno"><a class="line" href="classliblame_1_1_m_p3_encoder_l_a_m_e.html#a607e20eb9ece6df2a54efdd038c34fcd">  121</a></span>  <a class="code hl_struct" href="structliblame_1_1_audio_info.html">AudioInfo</a> <a class="code hl_function" href="classliblame_1_1_m_p3_encoder_l_a_m_e.html#a607e20eb9ece6df2a54efdd038c34fcd">audioInfo</a>() { <span class="keywordflow">return</span> info; }</div>
<div class="line"><a id="l00122" name="l00122"></a><span class="lineno">  122</span> </div>
<div class="line"><a id="l00124" name="l00124"></a><span class="lineno"><a class="line" href="classliblame_1_1_m_p3_encoder_l_a_m_e.html#a5aeaae2e0b9e9ac9fdf7e3ebb68fc404">  124</a></span>  int32_t <a class="code hl_function" href="classliblame_1_1_m_p3_encoder_l_a_m_e.html#a5aeaae2e0b9e9ac9fdf7e3ebb68fc404">write</a>(<span class="keywordtype">void</span> *pcm_samples, <span class="keywordtype">int</span> bytes) {</div>
<div class="line"><a id="l00125" name="l00125"></a><span class="lineno">  125</span>    int32_t result = 0;</div>
<div class="line"><a id="l00126" name="l00126"></a><span class="lineno">  126</span>    <span class="keywordflow">if</span> (active) {</div>
<div class="line"><a id="l00127" name="l00127"></a><span class="lineno">  127</span>      LOG_LAME(Debug, <span class="stringliteral">&quot;write %d bytes&quot;</span>, bytes);</div>
<div class="line"><a id="l00128" name="l00128"></a><span class="lineno">  128</span> </div>
<div class="line"><a id="l00129" name="l00129"></a><span class="lineno">  129</span>      <span class="comment">// convert to required input format</span></div>
<div class="line"><a id="l00130" name="l00130"></a><span class="lineno">  130</span>      <span class="keywordtype">short</span> *buffer = convertToShort(pcm_samples, bytes);</div>
<div class="line"><a id="l00131" name="l00131"></a><span class="lineno">  131</span>      <span class="keywordflow">if</span> (buffer == <span class="keyword">nullptr</span>) {</div>
<div class="line"><a id="l00132" name="l00132"></a><span class="lineno">  132</span>        <span class="keywordflow">return</span> 0;</div>
<div class="line"><a id="l00133" name="l00133"></a><span class="lineno">  133</span>      }</div>
<div class="line"><a id="l00134" name="l00134"></a><span class="lineno">  134</span> </div>
<div class="line"><a id="l00135" name="l00135"></a><span class="lineno">  135</span>      <span class="comment">// setup output buffer if necessary</span></div>
<div class="line"><a id="l00136" name="l00136"></a><span class="lineno">  136</span>      <span class="keywordtype">int</span> nsamples = bytes / (info.bits_per_sample / 8) / info.channels;</div>
<div class="line"><a id="l00137" name="l00137"></a><span class="lineno">  137</span>      <span class="keywordtype">int</span> outbuf_size = 7200 + (1.25 * nsamples);</div>
<div class="line"><a id="l00138" name="l00138"></a><span class="lineno">  138</span>      <span class="keywordflow">if</span> (!setupOutputBuffer(outbuf_size)) {</div>
<div class="line"><a id="l00139" name="l00139"></a><span class="lineno">  139</span>        <span class="keywordflow">return</span> 0;</div>
<div class="line"><a id="l00140" name="l00140"></a><span class="lineno">  140</span>      }</div>
<div class="line"><a id="l00141" name="l00141"></a><span class="lineno">  141</span> </div>
<div class="line"><a id="l00142" name="l00142"></a><span class="lineno">  142</span>      <span class="comment">// encode based on the number of channels</span></div>
<div class="line"><a id="l00143" name="l00143"></a><span class="lineno">  143</span>      <span class="keywordtype">int</span> mp3_len = 0;</div>
<div class="line"><a id="l00144" name="l00144"></a><span class="lineno">  144</span>      <span class="keywordflow">if</span> (info.channels == 1) {</div>
<div class="line"><a id="l00145" name="l00145"></a><span class="lineno">  145</span>        mp3_len =</div>
<div class="line"><a id="l00146" name="l00146"></a><span class="lineno">  146</span>            lame_encode_buffer(lame, buffer, NULL, nsamples, mp3_buffer, 0);</div>
<div class="line"><a id="l00147" name="l00147"></a><span class="lineno">  147</span>      } <span class="keywordflow">else</span> {</div>
<div class="line"><a id="l00148" name="l00148"></a><span class="lineno">  148</span>        mp3_len = lame_encode_buffer_interleaved(lame, buffer, nsamples,</div>
<div class="line"><a id="l00149" name="l00149"></a><span class="lineno">  149</span>                                                 mp3_buffer, 0);</div>
<div class="line"><a id="l00150" name="l00150"></a><span class="lineno">  150</span>      }</div>
<div class="line"><a id="l00151" name="l00151"></a><span class="lineno">  151</span> </div>
<div class="line"><a id="l00152" name="l00152"></a><span class="lineno">  152</span>      <span class="keywordflow">if</span> (mp3_len &gt; 0) {</div>
<div class="line"><a id="l00153" name="l00153"></a><span class="lineno">  153</span>        <a class="code hl_function" href="classliblame_1_1_m_p3_encoder_l_a_m_e.html#a67d26a63919418cf0916afba121f16ac">provideResult</a>((uint8_t *)mp3_buffer, mp3_len);</div>
<div class="line"><a id="l00154" name="l00154"></a><span class="lineno">  154</span>      }</div>
<div class="line"><a id="l00155" name="l00155"></a><span class="lineno">  155</span>      result = bytes;</div>
<div class="line"><a id="l00156" name="l00156"></a><span class="lineno">  156</span>    }</div>
<div class="line"><a id="l00157" name="l00157"></a><span class="lineno">  157</span>    <span class="keywordflow">return</span> result;</div>
<div class="line"><a id="l00158" name="l00158"></a><span class="lineno">  158</span>  }</div>
<div class="line"><a id="l00159" name="l00159"></a><span class="lineno">  159</span> </div>
<div class="line"><a id="l00161" name="l00161"></a><span class="lineno"><a class="line" href="classliblame_1_1_m_p3_encoder_l_a_m_e.html#af50990122ad669a7a4755aac47d5046f">  161</a></span>  <span class="keywordtype">void</span> <a class="code hl_function" href="classliblame_1_1_m_p3_encoder_l_a_m_e.html#af50990122ad669a7a4755aac47d5046f">end</a>() {</div>
<div class="line"><a id="l00162" name="l00162"></a><span class="lineno">  162</span>    LOG_LAME(Debug, __FUNCTION__);</div>
<div class="line"><a id="l00163" name="l00163"></a><span class="lineno">  163</span>    lame_close(lame);</div>
<div class="line"><a id="l00164" name="l00164"></a><span class="lineno">  164</span>    lame = <span class="keyword">nullptr</span>;</div>
<div class="line"><a id="l00165" name="l00165"></a><span class="lineno">  165</span>  }</div>
<div class="line"><a id="l00166" name="l00166"></a><span class="lineno">  166</span> </div>
<div class="line"><a id="l00167" name="l00167"></a><span class="lineno">  167</span>  <span class="keyword">operator</span> boolean() { <span class="keywordflow">return</span> active; }</div>
<div class="line"><a id="l00168" name="l00168"></a><span class="lineno">  168</span> </div>
<div class="line"><a id="l00169" name="l00169"></a><span class="lineno">  169</span><span class="keyword">protected</span>:</div>
<div class="line"><a id="l00170" name="l00170"></a><span class="lineno">  170</span>  <span class="keywordtype">bool</span> active;</div>
<div class="line"><a id="l00171" name="l00171"></a><span class="lineno">  171</span>  MP3CallbackFDK MP3Callback = <span class="keyword">nullptr</span>;</div>
<div class="line"><a id="l00172" name="l00172"></a><span class="lineno">  172</span>  AudioInfo info;</div>
<div class="line"><a id="l00173" name="l00173"></a><span class="lineno">  173</span>  <span class="comment">// lame</span></div>
<div class="line"><a id="l00174" name="l00174"></a><span class="lineno">  174</span>  lame_t lame = <span class="keyword">nullptr</span>;</div>
<div class="line"><a id="l00175" name="l00175"></a><span class="lineno">  175</span>  <span class="comment">// mp3 result buffer</span></div>
<div class="line"><a id="l00176" name="l00176"></a><span class="lineno">  176</span>  uint8_t *mp3_buffer = <span class="keyword">nullptr</span>;</div>
<div class="line"><a id="l00177" name="l00177"></a><span class="lineno">  177</span>  <span class="keywordtype">int</span> mp3_buffer_size = 0;</div>
<div class="line"><a id="l00178" name="l00178"></a><span class="lineno">  178</span>  <span class="comment">// conversion to short</span></div>
<div class="line"><a id="l00179" name="l00179"></a><span class="lineno">  179</span>  <span class="keywordtype">short</span> *convert_buffer = <span class="keyword">nullptr</span>;</div>
<div class="line"><a id="l00180" name="l00180"></a><span class="lineno">  180</span>  <span class="keywordtype">int</span> convert_buffer_size = 0;</div>
<div class="line"><a id="l00181" name="l00181"></a><span class="lineno">  181</span> </div>
<div class="line"><a id="l00182" name="l00182"></a><span class="lineno">  182</span><span class="preprocessor">#ifdef ARDUINO</span></div>
<div class="line"><a id="l00183" name="l00183"></a><span class="lineno">  183</span>  Print *out;</div>
<div class="line"><a id="l00184" name="l00184"></a><span class="lineno">  184</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00185" name="l00185"></a><span class="lineno">  185</span> </div>
<div class="line"><a id="l00186" name="l00186"></a><span class="lineno">  186</span>  <span class="keywordtype">bool</span> setupOutputBuffer(<span class="keywordtype">int</span> size) {</div>
<div class="line"><a id="l00187" name="l00187"></a><span class="lineno">  187</span>    <span class="keywordflow">if</span> (size &gt; mp3_buffer_size) {</div>
<div class="line"><a id="l00188" name="l00188"></a><span class="lineno">  188</span>      LOG_LAME(Debug, __FUNCTION__);</div>
<div class="line"><a id="l00189" name="l00189"></a><span class="lineno">  189</span>      <span class="keywordflow">if</span> (mp3_buffer != <span class="keyword">nullptr</span>)</div>
<div class="line"><a id="l00190" name="l00190"></a><span class="lineno">  190</span>        <span class="keyword">delete</span>[] mp3_buffer;</div>
<div class="line"><a id="l00191" name="l00191"></a><span class="lineno">  191</span>      mp3_buffer = <span class="keyword">new</span> uint8_t[size];</div>
<div class="line"><a id="l00192" name="l00192"></a><span class="lineno">  192</span>      mp3_buffer_size = size;</div>
<div class="line"><a id="l00193" name="l00193"></a><span class="lineno">  193</span>    }</div>
<div class="line"><a id="l00194" name="l00194"></a><span class="lineno">  194</span>    <span class="keywordflow">return</span> mp3_buffer != <span class="keyword">nullptr</span>;</div>
<div class="line"><a id="l00195" name="l00195"></a><span class="lineno">  195</span>  }</div>
<div class="line"><a id="l00196" name="l00196"></a><span class="lineno">  196</span> </div>
<div class="line"><a id="l00197" name="l00197"></a><span class="lineno">  197</span>  <span class="keywordtype">bool</span> setup() {</div>
<div class="line"><a id="l00198" name="l00198"></a><span class="lineno">  198</span>    LOG_LAME(Debug, __FUNCTION__);</div>
<div class="line"><a id="l00199" name="l00199"></a><span class="lineno">  199</span>    <span class="keywordflow">if</span> (lame==<span class="keyword">nullptr</span>){</div>
<div class="line"><a id="l00200" name="l00200"></a><span class="lineno">  200</span>      lame = lame_init();</div>
<div class="line"><a id="l00201" name="l00201"></a><span class="lineno">  201</span>    }</div>
<div class="line"><a id="l00202" name="l00202"></a><span class="lineno">  202</span>    <span class="keywordflow">if</span> (lame == <span class="keyword">nullptr</span>) {</div>
<div class="line"><a id="l00203" name="l00203"></a><span class="lineno">  203</span>      LOG_LAME(Error, <span class="stringliteral">&quot;lame_init failed&quot;</span>);</div>
<div class="line"><a id="l00204" name="l00204"></a><span class="lineno">  204</span>      <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
<div class="line"><a id="l00205" name="l00205"></a><span class="lineno">  205</span>    }</div>
<div class="line"><a id="l00206" name="l00206"></a><span class="lineno">  206</span> </div>
<div class="line"><a id="l00207" name="l00207"></a><span class="lineno">  207</span>    lame_set_VBR(lame, vbr_default);</div>
<div class="line"><a id="l00208" name="l00208"></a><span class="lineno">  208</span>    lame_set_num_channels(lame, info.channels);</div>
<div class="line"><a id="l00209" name="l00209"></a><span class="lineno">  209</span>    <span class="keywordflow">if</span> (info.channels == 1) {</div>
<div class="line"><a id="l00210" name="l00210"></a><span class="lineno">  210</span>      lame_set_mode(lame, MONO);</div>
<div class="line"><a id="l00211" name="l00211"></a><span class="lineno">  211</span>    }</div>
<div class="line"><a id="l00212" name="l00212"></a><span class="lineno">  212</span>    lame_set_in_samplerate(lame, info.sample_rate);</div>
<div class="line"><a id="l00213" name="l00213"></a><span class="lineno">  213</span>    lame_set_quality(lame, info.quality);</div>
<div class="line"><a id="l00214" name="l00214"></a><span class="lineno">  214</span> </div>
<div class="line"><a id="l00215" name="l00215"></a><span class="lineno">  215</span>    <span class="keywordtype">int</span> initRet = lame_init_params(lame);</div>
<div class="line"><a id="l00216" name="l00216"></a><span class="lineno">  216</span>    <span class="keywordflow">if</span> (initRet &lt; 0) {</div>
<div class="line"><a id="l00217" name="l00217"></a><span class="lineno">  217</span>      LOG_LAME(Error, <span class="stringliteral">&quot;lame_init_params\n&quot;</span>);</div>
<div class="line"><a id="l00218" name="l00218"></a><span class="lineno">  218</span>      <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
<div class="line"><a id="l00219" name="l00219"></a><span class="lineno">  219</span>    }</div>
<div class="line"><a id="l00220" name="l00220"></a><span class="lineno">  220</span> </div>
<div class="line"><a id="l00221" name="l00221"></a><span class="lineno">  221</span>    info.frame_size = lame_get_framesize(lame);</div>
<div class="line"><a id="l00222" name="l00222"></a><span class="lineno">  222</span>    LOG_LAME(Info, <span class="stringliteral">&quot;Framesize = %d\n&quot;</span>, info.frame_size);</div>
<div class="line"><a id="l00223" name="l00223"></a><span class="lineno">  223</span>    <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line"><a id="l00224" name="l00224"></a><span class="lineno">  224</span>  }</div>
<div class="line"><a id="l00225" name="l00225"></a><span class="lineno">  225</span> </div>
<div class="line"><a id="l00226" name="l00226"></a><span class="lineno">  226</span>  <span class="keywordtype">short</span> *convertToShort(<span class="keywordtype">void</span> *pcm_samples, <span class="keywordtype">int</span> bytes) {</div>
<div class="line"><a id="l00227" name="l00227"></a><span class="lineno">  227</span>    <span class="keywordtype">int</span> bytes_per_sample = info.bits_per_sample / 8;</div>
<div class="line"><a id="l00228" name="l00228"></a><span class="lineno">  228</span>    <span class="comment">// input is already in correct format</span></div>
<div class="line"><a id="l00229" name="l00229"></a><span class="lineno">  229</span>    <span class="keywordflow">if</span> (<span class="keyword">sizeof</span>(<span class="keywordtype">short</span>) == bytes_per_sample) {</div>
<div class="line"><a id="l00230" name="l00230"></a><span class="lineno">  230</span>      <span class="keywordflow">return</span> (<span class="keywordtype">short</span> *)pcm_samples;</div>
<div class="line"><a id="l00231" name="l00231"></a><span class="lineno">  231</span>    }</div>
<div class="line"><a id="l00232" name="l00232"></a><span class="lineno">  232</span> </div>
<div class="line"><a id="l00233" name="l00233"></a><span class="lineno">  233</span>    <span class="comment">// if we got here conversion is required</span></div>
<div class="line"><a id="l00234" name="l00234"></a><span class="lineno">  234</span>    LOG_LAME(Debug, __FUNCTION__);</div>
<div class="line"><a id="l00235" name="l00235"></a><span class="lineno">  235</span> </div>
<div class="line"><a id="l00236" name="l00236"></a><span class="lineno">  236</span>    <span class="comment">// allocate conversion buffer</span></div>
<div class="line"><a id="l00237" name="l00237"></a><span class="lineno">  237</span>    <span class="keywordtype">int</span> samples = bytes / bytes_per_sample;</div>
<div class="line"><a id="l00238" name="l00238"></a><span class="lineno">  238</span>    <span class="keywordflow">if</span> (convert_buffer == <span class="keyword">nullptr</span> || samples &gt; convert_buffer_size) {</div>
<div class="line"><a id="l00239" name="l00239"></a><span class="lineno">  239</span>      <span class="keywordflow">if</span> (convert_buffer != <span class="keyword">nullptr</span>) {</div>
<div class="line"><a id="l00240" name="l00240"></a><span class="lineno">  240</span>        <span class="keyword">delete</span>[] convert_buffer;</div>
<div class="line"><a id="l00241" name="l00241"></a><span class="lineno">  241</span>      }</div>
<div class="line"><a id="l00242" name="l00242"></a><span class="lineno">  242</span>      convert_buffer = <span class="keyword">new</span> <span class="keywordtype">short</span>[samples];</div>
<div class="line"><a id="l00243" name="l00243"></a><span class="lineno">  243</span>      convert_buffer_size = samples;</div>
<div class="line"><a id="l00244" name="l00244"></a><span class="lineno">  244</span>    }</div>
<div class="line"><a id="l00245" name="l00245"></a><span class="lineno">  245</span> </div>
<div class="line"><a id="l00246" name="l00246"></a><span class="lineno">  246</span>    <span class="keywordflow">if</span> (convert_buffer == <span class="keyword">nullptr</span>) {</div>
<div class="line"><a id="l00247" name="l00247"></a><span class="lineno">  247</span>      LOG_LAME(Error, <span class="stringliteral">&quot;not enough memory to allocate conversion buffer - decrise &quot;</span></div>
<div class="line"><a id="l00248" name="l00248"></a><span class="lineno">  248</span>                 <span class="stringliteral">&quot;the size of written bytes!&quot;</span>)</div>
<div class="line"><a id="l00249" name="l00249"></a><span class="lineno">  249</span>      lame_abort();</div>
<div class="line"><a id="l00250" name="l00250"></a><span class="lineno">  250</span>      return <span class="keywordtype">nullptr</span>;</div>
<div class="line"><a id="l00251" name="l00251"></a><span class="lineno">  251</span>    }</div>
<div class="line"><a id="l00252" name="l00252"></a><span class="lineno">  252</span> </div>
<div class="line"><a id="l00253" name="l00253"></a><span class="lineno">  253</span>    <span class="comment">// convert input to short</span></div>
<div class="line"><a id="l00254" name="l00254"></a><span class="lineno">  254</span>    switch (info.bits_per_sample) {</div>
<div class="line"><a id="l00255" name="l00255"></a><span class="lineno">  255</span>    <span class="keywordflow">case</span> 8: {</div>
<div class="line"><a id="l00256" name="l00256"></a><span class="lineno">  256</span>      int8_t *ptr = (int8_t *)pcm_samples;</div>
<div class="line"><a id="l00257" name="l00257"></a><span class="lineno">  257</span>      <span class="keywordflow">for</span> (<span class="keywordtype">int</span> j = 0; j &lt; samples; j++) {</div>
<div class="line"><a id="l00258" name="l00258"></a><span class="lineno">  258</span>        convert_buffer[j] = ptr[j];</div>
<div class="line"><a id="l00259" name="l00259"></a><span class="lineno">  259</span>      }</div>
<div class="line"><a id="l00260" name="l00260"></a><span class="lineno">  260</span>      <span class="keywordflow">return</span> convert_buffer;</div>
<div class="line"><a id="l00261" name="l00261"></a><span class="lineno">  261</span>    }</div>
<div class="line"><a id="l00262" name="l00262"></a><span class="lineno">  262</span>    <span class="keywordflow">case</span> 16: {</div>
<div class="line"><a id="l00263" name="l00263"></a><span class="lineno">  263</span>      int16_t *ptr = (int16_t *)pcm_samples;</div>
<div class="line"><a id="l00264" name="l00264"></a><span class="lineno">  264</span>      <span class="keywordflow">for</span> (<span class="keywordtype">int</span> j = 0; j &lt; samples; j++) {</div>
<div class="line"><a id="l00265" name="l00265"></a><span class="lineno">  265</span>        convert_buffer[j] = ptr[j];</div>
<div class="line"><a id="l00266" name="l00266"></a><span class="lineno">  266</span>      }</div>
<div class="line"><a id="l00267" name="l00267"></a><span class="lineno">  267</span>      <span class="keywordflow">return</span> convert_buffer;</div>
<div class="line"><a id="l00268" name="l00268"></a><span class="lineno">  268</span>    }</div>
<div class="line"><a id="l00269" name="l00269"></a><span class="lineno">  269</span>    <span class="keywordflow">case</span> 32: {</div>
<div class="line"><a id="l00270" name="l00270"></a><span class="lineno">  270</span>      int32_t *ptr = (int32_t *)pcm_samples;</div>
<div class="line"><a id="l00271" name="l00271"></a><span class="lineno">  271</span>      <span class="keywordflow">for</span> (<span class="keywordtype">int</span> j = 0; j &lt; samples; j++) {</div>
<div class="line"><a id="l00272" name="l00272"></a><span class="lineno">  272</span>        convert_buffer[j] = ptr[j];</div>
<div class="line"><a id="l00273" name="l00273"></a><span class="lineno">  273</span>      }</div>
<div class="line"><a id="l00274" name="l00274"></a><span class="lineno">  274</span>      <span class="keywordflow">return</span> convert_buffer;</div>
<div class="line"><a id="l00275" name="l00275"></a><span class="lineno">  275</span>    }</div>
<div class="line"><a id="l00276" name="l00276"></a><span class="lineno">  276</span>    <span class="keywordflow">default</span>:</div>
<div class="line"><a id="l00277" name="l00277"></a><span class="lineno">  277</span>      LOG_LAME(Error, <span class="stringliteral">&quot;Unsupported bits_per_sample: %d&quot;</span>, info.bits_per_sample);</div>
<div class="line"><a id="l00278" name="l00278"></a><span class="lineno">  278</span>      <span class="keywordflow">return</span> <span class="keyword">nullptr</span>;</div>
<div class="line"><a id="l00279" name="l00279"></a><span class="lineno">  279</span>    }</div>
<div class="line"><a id="l00280" name="l00280"></a><span class="lineno">  280</span>  }</div>
<div class="line"><a id="l00281" name="l00281"></a><span class="lineno">  281</span> </div>
<div class="line"><a id="l00283" name="l00283"></a><span class="lineno"><a class="line" href="classliblame_1_1_m_p3_encoder_l_a_m_e.html#a67d26a63919418cf0916afba121f16ac">  283</a></span>  <span class="keywordtype">void</span> <a class="code hl_function" href="classliblame_1_1_m_p3_encoder_l_a_m_e.html#a67d26a63919418cf0916afba121f16ac">provideResult</a>(uint8_t *data, <span class="keywordtype">size_t</span> bytes) {</div>
<div class="line"><a id="l00284" name="l00284"></a><span class="lineno">  284</span>    <span class="keywordflow">if</span> (bytes &gt; 0) {</div>
<div class="line"><a id="l00285" name="l00285"></a><span class="lineno">  285</span>      LOG_LAME(Debug, <span class="stringliteral">&quot;provideResult: %zu samples&quot;</span>, bytes);</div>
<div class="line"><a id="l00286" name="l00286"></a><span class="lineno">  286</span>      <span class="comment">// provide result</span></div>
<div class="line"><a id="l00287" name="l00287"></a><span class="lineno">  287</span>      <span class="keywordflow">if</span> (MP3Callback != <span class="keyword">nullptr</span>) {</div>
<div class="line"><a id="l00288" name="l00288"></a><span class="lineno">  288</span>        <span class="comment">// output via callback</span></div>
<div class="line"><a id="l00289" name="l00289"></a><span class="lineno">  289</span>        MP3Callback(data, bytes);</div>
<div class="line"><a id="l00290" name="l00290"></a><span class="lineno">  290</span>      }</div>
<div class="line"><a id="l00291" name="l00291"></a><span class="lineno">  291</span><span class="preprocessor">#ifdef ARDUINO</span></div>
<div class="line"><a id="l00292" name="l00292"></a><span class="lineno">  292</span>      <span class="keywordflow">if</span> (out != <span class="keyword">nullptr</span>) {</div>
<div class="line"><a id="l00293" name="l00293"></a><span class="lineno">  293</span>        out-&gt;write((uint8_t *)data, bytes);</div>
<div class="line"><a id="l00294" name="l00294"></a><span class="lineno">  294</span>      }</div>
<div class="line"><a id="l00295" name="l00295"></a><span class="lineno">  295</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00296" name="l00296"></a><span class="lineno">  296</span>    }</div>
<div class="line"><a id="l00297" name="l00297"></a><span class="lineno">  297</span>  }</div>
<div class="line"><a id="l00298" name="l00298"></a><span class="lineno">  298</span>};</div>
<div class="line"><a id="l00299" name="l00299"></a><span class="lineno">  299</span> </div>
<div class="line"><a id="l00300" name="l00300"></a><span class="lineno">  300</span>} <span class="comment">// namespace liblame</span></div>
<div class="ttc" id="aclassliblame_1_1_m_p3_encoder_l_a_m_e_html"><div class="ttname"><a href="classliblame_1_1_m_p3_encoder_l_a_m_e.html">liblame::MP3EncoderLAME</a></div><div class="ttdoc">Encodes PCM data to the MP3 format and writes the result to a stream or provides it via a callback.</div><div class="ttdef"><b>Definition:</b> MP3EncoderLAME.h:32</div></div>
<div class="ttc" id="aclassliblame_1_1_m_p3_encoder_l_a_m_e_html_a0be6b928f81d76de826faec024a9003a"><div class="ttname"><a href="classliblame_1_1_m_p3_encoder_l_a_m_e.html#a0be6b928f81d76de826faec024a9003a">liblame::MP3EncoderLAME::begin</a></div><div class="ttdeci">void begin()</div><div class="ttdoc">Opens the encoder.</div><div class="ttdef"><b>Definition:</b> MP3EncoderLAME.h:81</div></div>
<div class="ttc" id="aclassliblame_1_1_m_p3_encoder_l_a_m_e_html_a0f0fca79af6535e186a5555bd9019c50"><div class="ttname"><a href="classliblame_1_1_m_p3_encoder_l_a_m_e.html#a0f0fca79af6535e186a5555bd9019c50">liblame::MP3EncoderLAME::setOutput</a></div><div class="ttdeci">void setOutput(Print &amp;out_stream)</div><div class="ttdoc">Defines the output stream.</div><div class="ttdef"><b>Definition:</b> MP3EncoderLAME.h:61</div></div>
<div class="ttc" id="aclassliblame_1_1_m_p3_encoder_l_a_m_e_html_a2fe02f33ec1c5fc4cb7e14354bc6a2fd"><div class="ttname"><a href="classliblame_1_1_m_p3_encoder_l_a_m_e.html#a2fe02f33ec1c5fc4cb7e14354bc6a2fd">liblame::MP3EncoderLAME::MP3EncoderLAME</a></div><div class="ttdeci">MP3EncoderLAME(Print &amp;out_stream)</div><div class="ttdef"><b>Definition:</b> MP3EncoderLAME.h:55</div></div>
<div class="ttc" id="aclassliblame_1_1_m_p3_encoder_l_a_m_e_html_a47b52eaec66ff4513a483d4ce6ceeb6a"><div class="ttname"><a href="classliblame_1_1_m_p3_encoder_l_a_m_e.html#a47b52eaec66ff4513a483d4ce6ceeb6a">liblame::MP3EncoderLAME::begin</a></div><div class="ttdeci">void begin(int input_channels, int input_sample_rate, int input_bits_per_sample)</div><div class="ttdoc">Opens the encoder.</div><div class="ttdef"><b>Definition:</b> MP3EncoderLAME.h:106</div></div>
<div class="ttc" id="aclassliblame_1_1_m_p3_encoder_l_a_m_e_html_a4fb46c73fd0be4e376c1f72d875b3297"><div class="ttname"><a href="classliblame_1_1_m_p3_encoder_l_a_m_e.html#a4fb46c73fd0be4e376c1f72d875b3297">liblame::MP3EncoderLAME::begin</a></div><div class="ttdeci">void begin(AudioInfo in)</div><div class="ttdoc">Opens the encoder.</div><div class="ttdef"><b>Definition:</b> MP3EncoderLAME.h:92</div></div>
<div class="ttc" id="aclassliblame_1_1_m_p3_encoder_l_a_m_e_html_a54352c07c33e664c8c2bd72331c8b070"><div class="ttname"><a href="classliblame_1_1_m_p3_encoder_l_a_m_e.html#a54352c07c33e664c8c2bd72331c8b070">liblame::MP3EncoderLAME::MP3EncoderLAME</a></div><div class="ttdeci">MP3EncoderLAME(MP3CallbackFDK cb)</div><div class="ttdoc">Constructor which provides the decoded result in a callback.</div><div class="ttdef"><b>Definition:</b> MP3EncoderLAME.h:40</div></div>
<div class="ttc" id="aclassliblame_1_1_m_p3_encoder_l_a_m_e_html_a5aeaae2e0b9e9ac9fdf7e3ebb68fc404"><div class="ttname"><a href="classliblame_1_1_m_p3_encoder_l_a_m_e.html#a5aeaae2e0b9e9ac9fdf7e3ebb68fc404">liblame::MP3EncoderLAME::write</a></div><div class="ttdeci">int32_t write(void *pcm_samples, int bytes)</div><div class="ttdoc">write PCM data to be converted to MP3 - The size is in bytes</div><div class="ttdef"><b>Definition:</b> MP3EncoderLAME.h:124</div></div>
<div class="ttc" id="aclassliblame_1_1_m_p3_encoder_l_a_m_e_html_a607e20eb9ece6df2a54efdd038c34fcd"><div class="ttname"><a href="classliblame_1_1_m_p3_encoder_l_a_m_e.html#a607e20eb9ece6df2a54efdd038c34fcd">liblame::MP3EncoderLAME::audioInfo</a></div><div class="ttdeci">AudioInfo audioInfo()</div><div class="ttdoc">Provides the audio information.</div><div class="ttdef"><b>Definition:</b> MP3EncoderLAME.h:121</div></div>
<div class="ttc" id="aclassliblame_1_1_m_p3_encoder_l_a_m_e_html_a67d26a63919418cf0916afba121f16ac"><div class="ttname"><a href="classliblame_1_1_m_p3_encoder_l_a_m_e.html#a67d26a63919418cf0916afba121f16ac">liblame::MP3EncoderLAME::provideResult</a></div><div class="ttdeci">void provideResult(uint8_t *data, size_t bytes)</div><div class="ttdoc">return the result PWM data</div><div class="ttdef"><b>Definition:</b> MP3EncoderLAME.h:283</div></div>
<div class="ttc" id="aclassliblame_1_1_m_p3_encoder_l_a_m_e_html_a7e35cfa7cc48b05cf49b0b72ef0e03bc"><div class="ttname"><a href="classliblame_1_1_m_p3_encoder_l_a_m_e.html#a7e35cfa7cc48b05cf49b0b72ef0e03bc">liblame::MP3EncoderLAME::MP3EncoderLAME</a></div><div class="ttdeci">MP3EncoderLAME()</div><div class="ttdef"><b>Definition:</b> MP3EncoderLAME.h:37</div></div>
<div class="ttc" id="aclassliblame_1_1_m_p3_encoder_l_a_m_e_html_a8385df8de26ce70ea594f3b7deee6415"><div class="ttname"><a href="classliblame_1_1_m_p3_encoder_l_a_m_e.html#a8385df8de26ce70ea594f3b7deee6415">liblame::MP3EncoderLAME::setDataCallback</a></div><div class="ttdeci">void setDataCallback(MP3CallbackFDK cb)</div><div class="ttdoc">Defines the callback which receives the encded MP3 data.</div><div class="ttdef"><b>Definition:</b> MP3EncoderLAME.h:46</div></div>
<div class="ttc" id="aclassliblame_1_1_m_p3_encoder_l_a_m_e_html_af244cdcd8bac44f739d874038216b1cf"><div class="ttname"><a href="classliblame_1_1_m_p3_encoder_l_a_m_e.html#af244cdcd8bac44f739d874038216b1cf">liblame::MP3EncoderLAME::setAudioInfo</a></div><div class="ttdeci">void setAudioInfo(AudioInfo in)</div><div class="ttdoc">Defines the audio information.</div><div class="ttdef"><b>Definition:</b> MP3EncoderLAME.h:118</div></div>
<div class="ttc" id="aclassliblame_1_1_m_p3_encoder_l_a_m_e_html_af50990122ad669a7a4755aac47d5046f"><div class="ttname"><a href="classliblame_1_1_m_p3_encoder_l_a_m_e.html#af50990122ad669a7a4755aac47d5046f">liblame::MP3EncoderLAME::end</a></div><div class="ttdeci">void end()</div><div class="ttdoc">closes the processing and release resources</div><div class="ttdef"><b>Definition:</b> MP3EncoderLAME.h:161</div></div>
<div class="ttc" id="alame__log_8h_html"><div class="ttname"><a href="lame__log_8h.html">lame_log.h</a></div><div class="ttdoc">Simple Logging.</div></div>
<div class="ttc" id="astructliblame_1_1_audio_info_html"><div class="ttname"><a href="structliblame_1_1_audio_info.html">liblame::AudioInfo</a></div><div class="ttdoc">LAME parameters.</div><div class="ttdef"><b>Definition:</b> MP3EncoderLAME.h:16</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.4
</small></address>
</body>
</html>
